/******************************************************************************
 * @file     cdc_serial.h
 * @brief    NANO100 series USB driver header file
 * @version  V1.00
 * $Revision: 1 $
 * $Date: 14/12/17 11:50a $
 *
 * @note
 * Copyright (C) 2013 Nuvoton Technology Corp. All rights reserved.
 ******************************************************************************/
#ifndef __USBD_HMD_H__
#define __USBD_HMD_H__

#include "Nano100Series.h"

/* Define the vendor id and product id */
#define USBD_VID        0x0416
#define USBD_PID        0x50A1

/*-------------------------------------------------------------*/
/* Define EP maximum packet size */
#define EP0_MAX_PKT_SIZE    64
#define EP1_MAX_PKT_SIZE    EP0_MAX_PKT_SIZE
#define EP2_MAX_PKT_SIZE    64
#define EP3_MAX_PKT_SIZE    64
#define EP4_MAX_PKT_SIZE    64
#define EP5_MAX_PKT_SIZE    64
#define EP6_MAX_PKT_SIZE    64
#define EP7_MAX_PKT_SIZE    64

#define SETUP_BUF_BASE      0
#define SETUP_BUF_LEN       8
#define EP0_BUF_BASE        (SETUP_BUF_BASE + SETUP_BUF_LEN)
#define EP0_BUF_LEN         EP0_MAX_PKT_SIZE
#define EP1_BUF_BASE        (SETUP_BUF_BASE + SETUP_BUF_LEN)
#define EP1_BUF_LEN         EP1_MAX_PKT_SIZE
#define EP2_BUF_BASE        (EP1_BUF_BASE + EP1_BUF_LEN)
#define EP2_BUF_LEN         EP2_MAX_PKT_SIZE
#define EP3_BUF_BASE        (EP2_BUF_BASE + EP2_BUF_LEN)
#define EP3_BUF_LEN         EP3_MAX_PKT_SIZE
#define EP4_BUF_BASE        (EP3_BUF_BASE + EP3_BUF_LEN)
#define EP4_BUF_LEN         EP4_MAX_PKT_SIZE
#define EP5_BUF_BASE        (EP4_BUF_BASE + EP4_BUF_LEN)
#define EP5_BUF_LEN         EP5_MAX_PKT_SIZE
#define EP6_BUF_BASE        (EP5_BUF_BASE + EP5_BUF_LEN)
#define EP6_BUF_LEN         EP6_MAX_PKT_SIZE
#define EP7_BUF_BASE        (EP6_BUF_BASE + EP6_BUF_LEN)
#define EP7_BUF_LEN         EP7_MAX_PKT_SIZE

/* Define the interrupt In EP number */
#define BULK_IN_EP_NUM_1	0x01
#define BULK_OUT_EP_NUM_1   0x01
#define BULK_IN_EP_NUM_2    0x02
#define BULK_OUT_EP_NUM_2   0x02
#define BULK_IN_EP_NUM_3    0x03
#define BULK_OUT_EP_NUM_3   0x03

/* Define Descriptor information */
#define USBD_SELF_POWERED               0
#define USBD_REMOTE_WAKEUP              0
#define USBD_MAX_POWER                  50  /* The unit is in 2mA. ex: 50 * 2mA = 100mA */

/*-------------------------------------------------------------*/

// 0~100
struct contrast {
	uint8_t w;
	uint8_t r;
	uint8_t g;
	uint8_t b;
};

struct brightness {
	uint8_t w;
	uint8_t r;
	uint8_t g;
	uint8_t b;
};

struct saturation {
	uint8_t w;
	uint8_t r;
	uint8_t g;
	uint8_t b;
};

// 4 bytes aligin!
struct hg_config {
	uint32_t version;
	
	// verison 1
	struct brightness tBrightness;
	struct contrast tContrast;
	struct saturation tSaturation;
	
	// version 2
	//
	
	uint32_t reserved;
};

void HMD_Init(void);
void HMD_ClassRequest(void);
void HMD_TransferData(void);

#endif  /* __USBD_HMD_H_ */

/*** (C) COPYRIGHT 2013 Nuvoton Technology Corp. ***/
